//
//  ZJShareClaimHeaderView.m
//  ShangHaiHuDongApp
//
//  Created by ZJ on 2017/6/14.
//  Copyright © 2017年 刘应平. All rights reserved.
//

#import "ZJShareClaimHeaderView.h"
//默认高度85
@interface ZJShareClaimHeaderView ()

/** 下划线 */
@property (nonatomic, strong) UILabel *underLine;

@end

@implementation ZJShareClaimHeaderView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self addSubview:self.imageView];
        [self addSubview:self.titleLabel];
        [self addSubview:self.name];
        [self addSubview:self.time];
        [self addSubview:self.underLine];
        
        self.imageView.sd_layout
        .topSpaceToView(self, 10 * [UIScreen zj_screenHScale])
        .leftSpaceToView(self, 12 * [UIScreen zj_screenWScale])
        .widthIs(60 * [UIScreen zj_screenWScale])
        .heightEqualToWidth();
        
        self.titleLabel.sd_layout
        .topSpaceToView(self, 20 * [UIScreen zj_screenHScale])
        .leftSpaceToView(self.imageView, 10 * [UIScreen zj_screenWScale])
        .rightSpaceToView(self, 12 * [UIScreen zj_screenWScale])
        .heightIs([NSString heightWithTextFont:self.titleLabel.font]);
        
        self.name.sd_layout
        .leftEqualToView(self.titleLabel)
        .bottomEqualToView(self.imageView)
        .topSpaceToView(self.titleLabel, 3 * [UIScreen zj_screenHScale])
        .widthIs(150 * [UIScreen zj_screenWScale]);
        
        self.time.sd_layout
        .topEqualToView(self.name)
        .leftSpaceToView(self.name, 0)
        .rightSpaceToView(self, 12 * [UIScreen zj_screenWScale])
        .heightRatioToView(self.name, 1);
        
        self.underLine.sd_layout
        .bottomSpaceToView(self, 0)
        .leftSpaceToView(self, 0)
        .rightSpaceToView(self, 0)
        .heightIs(5 * [UIScreen zj_screenHScale]);
    }
    return self;
}




#pragma mark - Setter

#pragma mark - Getters
- (UIImageView *)imageView{
    if (_imageView == nil){
        _imageView = [[UIImageView  alloc] init];
        _imageView.contentMode = UIViewContentModeCenter;
//        _imageView.image = [UIImage imageNamed:@"icon_xqrl"];
//        _imageView.backgroundColor = [UIColor themeColor];
    }
    return _imageView;
}

- (UILabel *)titleLabel{
    if (_titleLabel == nil){
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.textColor = [UIColor textBlackColor];
        _titleLabel.font = [UIFont systemFontOfSize:18 * [UIScreen zj_textFontScale]];
        _titleLabel.text = @"";
    }
    return _titleLabel;
}

- (UILabel *)time{
    if (_time == nil){
        _time = [[UILabel alloc] init];
        _time.textColor = [UIColor zj_colorWithHexString:@"a8a8a8"];
        _time.font = [UIFont systemFontOfSize:14 * [UIScreen zj_textFontScale]];
        _time.textAlignment = NSTextAlignmentRight;
        _time.text = @"";
    }
    return _time;
}
- (UIButton *)name{
    if (_name == nil){
        _name = [UIButton new];
        [_name setImage:[UIImage imageNamed:@"icon_idname"] forState:UIControlStateNormal];
        [_name setTitle:@"  " forState:UIControlStateNormal];
        [_name setTitleColor:[UIColor zj_colorWithHexString:@"a8a8a8"] forState:UIControlStateNormal];
        _name.titleLabel.font = [UIFont systemFontOfSize:14 *[UIScreen zj_textFontScale]];
        _name.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    }
    return _name;
}
- (UILabel *)underLine{
    if (_underLine == nil){
        _underLine = [[UILabel alloc] init];
        _underLine.backgroundColor = [UIColor zj_colorWithHexString:@"f2f2f2"];

    }
    return _underLine;
}
@end
